﻿using UnityEngine;
using System.Diagnostics;
using System.Reflection;
using System;
using System.Collections;
using System.Collections.Generic;
/// <summary>
/// 通过名字反射出类
/// 并实例化对象
/// 并加到缓存
/// </summary>
public class ConfigManager
{
    private static Dictionary<string, CSVReader> csvCache = new Dictionary<string, CSVReader>();

    public static Dictionary<string, CSVReader> CsvCache
    {
        get { return ConfigManager.csvCache; }
    }

    public static CSVReader GetCsvData(string csvfile)
    {
        CSVReader data;
        bool ret = csvCache.TryGetValue(csvfile, out data);
        if (!ret)
        {
            data = new CSVReader(csvfile);
            csvCache.Add(csvfile, data);
        }
        return data;
    }

    public static void Clear()
    {
        csvCache.Clear();
    }
}